//
//  ViewController.m
//  Attention
//
//  Created by student on 16/2/18.
//  Copyright © 2016年 niit. All rights reserved.
//

#import "ViewController.h"
//练习：
//1.分析整个应用中总共有多少哪些对象？罗列出来
/*
 UIApplication对象
 AppDelegate对象
 UIWindow对象
 ViewController对象(1)
 UIAlertview类的对象(3个)
 UIActionSheet类的对象(1个)
 UIButtond对象(4)
 UILable对象(1)
 UIView对象(1)
 */

//2.使用Reveal查看程序结构
//3.使用纯代码实现本程序
@interface ViewController ()

@property (weak, nonatomic) IBOutlet UILabel *LablePressed;


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - 弹出提示框（UIAlertView）
-(IBAction)bth1Pressed:(UIButton *)sender
{
 UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"弹出框标题"  //标题
                                               message:@"弹出框信息"        //信息
                                               delegate:self             //代理人（即哪个对象来处理这个UIAlertView对象的事件）
                                               cancelButtonTitle:@"确定"  //按钮上的文字
                                               otherButtonTitles: nil];    //更多按钮
    [alertView show];
}
-(IBAction)bth2Pressed:(UIButton *)sender
{
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"弹出框2"
                                                        message:@"中午吃饭了吗"
                                                       delegate:self
                                              cancelButtonTitle:@"取消"
                                              otherButtonTitles: @"确定",nil];
    [alertView show];
}
-(IBAction)bth3Pressed:(UIButton *)sender
{
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"登入"
                                                        message:@"请输入用户名和密码"
                                                       delegate:self
                                              cancelButtonTitle:@"取消"
                                              otherButtonTitles:@"确定", nil];
    //    UIAlertViewStyleDefault = 0,            // 默认,即无输入框
    //    UIAlertViewStyleSecureTextInput,        // 密码文本
    //    UIAlertViewStylePlainTextInput,         // 普通文本
    //    UIAlertViewStyleLoginAndPasswordInput   // 用户名密码
    alertView.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput;//UIAlertView对象的样式
    [alertView show];      
}

-(IBAction)bth4Pressed:(UIButton *)sender
{
    UIActionSheet *sheet = [[UIActionSheet alloc]initWithTitle:@"小明:一起出来吃饭吧？" delegate:self cancelButtonTitle:@"我吃过了，你去吧。" destructiveButtonTitle:@"好的，一起去" otherButtonTitles:@"一起去吃KFC吧",@"一起去吃MC", nil];
    [sheet showInView:self.view];
}

@end
